import React, { Component } from 'react'
import { Provider } from 'react-redux'
import {login} from './api/index'
import configStore from './store'

import './app.scss'

const store = configStore()

class App extends Component {
  componentDidMount () {
    wx.login({
      success: async res=>{
        // console.log('res...', res);
        let data = await login(res.code);
        wx.setStorageSync('openid', data.data.openid);
      }
    })

  }

  componentDidShow () {}

  componentDidHide () {}

  componentDidCatchError () {}

  // 在 App 类中的 render() 函数没有实际作用
  // 请勿修改此函数
  render () {
    return (
      <Provider store={store}>
        {this.props.children}
      </Provider>
    )
  }
}

export default App
